<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" href="/static/home/css/ydui.css">
		<link rel="stylesheet" href="/static/home/css/style.css" />
		<meta id="viewport" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=no">
		<title>登录</title>
		<script src="/static/home/js/ydui.flexible.js"></script>
	</head>
	<body style="background-color: #f1f4f8;height: auto;">
		<!--pages/login/login.wxml-->
		<div class="log-box">
			<img class="wx-logo-img" src="{$sys.logo}" style="border: 1px solid #fff"></img>
			<div class="form">
				<div class="">
					<div class="ipt-lg-box">
						<div class="ipt-box">
							<input type="number" class="usme-ipt" placeholder='请输入您的手机号码' />
							<img src="/static/home/images/user_icons.png" ></img>
						</div>
						<div class="ipt-box">
							<input type="password" class="usps-ipt" placeholder='请输入您的密码' />
							<img src="/static/home/images/pass_icons.png" ></img>
						</div>
					</div>
					<button class="lg-btn">登 录</button>
      
					<!--注册按钮  忘记密码按钮  -->
					<div class="btn-enroll-pass">
                     
						<a href="/register" class="enroll-btn" >立即注册</a>
						<a href="/forgetpwd" class="forget-pass-btn" >忘记密码?</a>
					</div>
				</div>
			</div>
		</div>
		<script src="/static/home/js/jquery-1.12.4.min.js"></script>
		<script src="/static/home/js/ydui.js"></script>
		<script>
			var $userIpt = $(".usme-ipt");
			var $passIpt = $(".usps-ipt");
			var regedg = /^1[0-9]{10}$/;
			$(".lg-btn").click(function(){
				if($userIpt.val()==""){
					YDUI.dialog.toast('请输入您的手机号码！', 'none', 1000);
					return;
				}
				if($passIpt.val()==""){
					YDUI.dialog.toast('请输入您的密码！', 'none', 1000);
					return;
				}
				if(!regedg.test($userIpt.val())){
					YDUI.dialog.toast('请输入正确的手机号码！', 'none', 1000);
					return;
				}
				YDUI.dialog.loading.open('登陆中...');
				$.post("{:url('/dologin')}",{tel:$userIpt.val(),pwd:$passIpt.val()},function(data){
					if(data.code == 0){
						setTimeout(function() {
							YDUI.dialog.loading.close();
							YDUI.dialog.toast(data.msg, 'success', 1000 ,function(){
							// location.replace("/user/index");
							location.replace("/user/index?time="+new Date().getTime());
							});
						}, 1000);
					}else if (data.code == 1){
						setTimeout(function() {
							YDUI.dialog.loading.close();
							YDUI.dialog.toast(data.msg, 'error', 1000 ,function(){});
						}, 1000);
					}else if (data.code ==4) {
						setTimeout(function() {
							YDUI.dialog.loading.close();
							YDUI.dialog.toast(data.msg, 'error', 1000 ,function(){});
						}, 1000);
					}else{
						setTimeout(function() {
							YDUI.dialog.loading.close();
							YDUI.dialog.toast(data.msg, 'error', 1000 ,function(){});
						}, 1000);
					}
				});
			})
		</script>
	</body>
</html>